package com.digitalchina.lxnsy.activity.farmVideo;

import android.content.Intent;
import android.webkit.JavascriptInterface;

import com.digitalchina.lxnsy.base.BaseHtmlActivity;
import com.digitalchina.lxnsy.toolkit.GotoUtil;

/**
 * ================================================
 * 项目名称：android
 * 类描述：作品管理
 * 创建人：rxx
 * 创建时间：2020/1/8 17:26
 * 修改备注：
 * ================================================
 */
public class MyWorkManageActivity extends BaseHtmlActivity {

    public static final int REQUEST_CODE = 100;
    @Override
    protected void loadHtml() {
        webView.addJavascriptObject(new JsApi(), null);
        loadUrl("my-work-manage");
        setTitle("作品管理");

    }

    @Override
    public void rightOnClick() {

    }

    public class JsApi {
        //发布
        @JavascriptInterface
        public void addVideo(Object msg) {
            GotoUtil.gotoForResultActivity(activity, AgrVideoEditActivity.class,REQUEST_CODE,"msg", msg.toString() );
        }

        //小视频详情
        @JavascriptInterface
        public void smallVideo(Object msg) {
            go(SmallVideoActivity.class,"msg",msg.toString());
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            callJsMethod("refresh");
        }
    }
}
